import { store } from "@/store";

// useAnalysetStore
export const useAnalyseStore = defineStore(
  "analyse",
  () => {
    const analyseStatusForm = ref({
      status: 0,
      qcStatus: 0,
      test_category: "",
    });
    const sampleStatus = ref({
      id: 0,
      qcId: 0,
      taskId: 0,
    });

    const waterForm = ref({
      id: 0,
      taskId: 0,
      record_sn: 0,
      add_form_id: 0,
      tableItem: {},
      tableItemList: {},
      task_number: "",
      test_category: "",
    });

    return {
      analyseStatusForm,
      sampleStatus,
      waterForm,
    };
  },
  {
    persist: {
      paths: ["analyseStatusForm", "sampleStatus", "waterForm"], // 只持久化 analyseStatusForm 字段
    },
  }
);

export function useAnalysetStore() {
  return useAnalyseStore(store);
}
